//
//  TitleBottomButton.swift
//  swift_wobo
//
//  Created by yuxin on 2018/11/17.
//  Copyright © 2018 wuxiantianli. All rights reserved.
//

import UIKit

class TitleBottomButton: UIButton {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        titleLabel?.textAlignment = NSTextAlignment.center
        titleLabel?.font = UIFont.systemFont(ofSize: 11)
        imageView?.contentMode = .center
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        let image_H : CGFloat = bounds.height * 0.8
        let title_H : CGFloat = bounds.height * 0.2
        
        imageView?.frame = CGRect(x: 0, y: 0, width: bounds.width, height: image_H)
        titleLabel?.frame = CGRect(x: 0, y: image_H, width: bounds.width, height: title_H)
    }

}
